Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Memory<​T>
Assembly: System.Runtime
Implemented Interfaces
Represents a contiguous region of memory.
Properties
public static
Memory<​T>
Empty
Returns an empty <see cref="T:System.Memory`1" /> object.
public
bool
IsEmpty
Indicates whether the current instance is empty.
public
int
Length
Gets the number of items in the current instance.
public
Span<​T>
Span
Returns a span from the current instance.
Methods
public
void
CopyTo​(Memory<​T> destination)
Copies the contents of a <see cref="T:System.Memory`1" /> object into a destination <see cref="T:System.Memory`1" /> object.
destination
The destination <see cref="T:System.Memory`1" /> object.
public
bool
Equals​(Memory<​T> other)
Determines whether the specified <see cref="T:System.Memory`1" /> object is equal to the current object.
Returns <see langword="true" /> if the current instance and <paramref name="other" /> are equal; otherwise, <see langword="false" /> .
other
The object to compare with the current instance.
public
bool
Equals​(object obj)
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" /> .
obj
The object to compare with the current instance.
public
int
GetHashCode​()
Returns the hash code for this instance.
Returns A 32-bit signed integer hash code.
public
MemoryHandle
Pin​()
Creates a handle for the <see cref="T:System.Memory`1" /> object.
Returns A handle for the <see cref="T:System.Memory`1" /> object.
public
Memory<​T>
Slice​(int start)
Forms a slice out of the current memory that begins at a specified index.
Returns An object that contains all elements of the current instance from <paramref name="start" /> to the end of the instance.
start
The index at which to begin the slice.
public
Memory<​T>
Slice​(int start,
int length)
Forms a slice out of the current memory starting at a specified index for a specified length.
Returns An object that contains <paramref name="length" /> elements from the current instance starting at <paramref name="start" /> .
start
The index at which to begin the slice.
length
The number of elements to include in the slice.
public
T[]
ToArray​()
Copies the contents from the memory into a new array.
Returns An array containing the elements in the current memory.
public
string
ToString​()
Returns the string representation of this <see cref="T:System.Memory`1" /> object.
Returns the string representation of this <see cref="T:System.Memory`1" /> object.
public
bool
TryCopyTo​(Memory<​T> destination)
Copies the contents of the memory into a destination <see cref="T:System.Memory`1" /> instance.
Returns <see langword="true" /> if the copy operation succeeds; otherwise, <see langword="false" /> .
destination
The destination <see cref="T:System.Memory`1" /> object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .